package com.liujit.bms.app.controller;

import com.liujit.bms.app.domain.params.BlogMemberFeedbackParams;
import com.liujit.bms.app.domain.query.BlogMemberFeedbackQuery;
import com.liujit.bms.app.domain.result.BlogMemberFeedbackResult;
import com.liujit.bms.app.service.BlogMemberFeedbackService;
import com.liujit.common.domain.params.BaseParams;
import com.liujit.common.domain.result.PageBean;
import com.liujit.validator.group.AddGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Description 博客会员反馈管理接口
 * @Author liujun
 * @Date 2021-07-16 14:18:02
 */
@RequiredArgsConstructor
@Api(tags = "博客会员反馈管理接口")
@RestController
@RequestMapping("/blog/member/feedback")
public class BlogMemberFeedbackController {

    private final BlogMemberFeedbackService blogMemberFeedbackService;

    @ApiOperation(value = "分页查询", notes = "根据博客会员反馈分页查询条件，分页查询博客会员反馈列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "query", value = "博客会员反馈分页查询条件", dataType = "BlogMemberFeedbackQuery", dataTypeClass = BlogMemberFeedbackQuery.class, paramType = "query") })
    @GetMapping("/getPage")
    public PageBean<BlogMemberFeedbackResult> getPage(BlogMemberFeedbackQuery query) {
        return blogMemberFeedbackService.getPage(query);
    }

    @ApiOperation(value = "添加", notes = "根据博客会员反馈添加请求参数，添加博客会员反馈")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "params", value = "博客会员反馈添加请求参数", dataType = "BlogMemberFeedbackParams", dataTypeClass = BlogMemberFeedbackParams.class, paramType = "body") })
    @PostMapping("add")
    public Boolean add(@RequestBody @Validated(AddGroup.class) BlogMemberFeedbackParams params) {
        return blogMemberFeedbackService.save(params);
    }

    @ApiOperation(value = "查询", notes = "根据博客会员反馈id，查询博客会员反馈")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "博客会员反馈id", dataType = "Long", dataTypeClass = Long.class, paramType = "query") })
    @GetMapping("/get")
    public BlogMemberFeedbackResult get(Long id) {
        return blogMemberFeedbackService.get(id);
    }

    @ApiOperation(value = "删除", notes = "根据博客会员反馈删除请求参数，删除博客会员反馈")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "params", value = "博客会员反馈删除请求参数", dataType = "BaseParams", dataTypeClass = BaseParams.class, paramType = "body") })
    @PostMapping("/del")
    public Boolean del(@RequestBody BaseParams params) {
        return blogMemberFeedbackService.del(params);
    }
}
